package com.rocksea.app.utils;

import java.util.HashMap;

/**
 * @author by Mrw_v @date on 2018/8/10
 */

public class HttpMessage
{
    public static final int verifyAppUser = 0;
    public static final int uploadLowStrain = 1;
	public static final int upLowStrainData = 2;
    public static final int uploadHighStrain = 3;
	public static final int uploadHighStrain_HammerData = 300;
	public static final int uploadHighStrain_ChannelData = 3000;
	public static final int uploadStaticLoad = 4;
    public static final int uploadStaticLoadTest = 5;
	public static final int uploadStaticLoadLog = 6;
    public static final int uploadSonicWave = 7;
	public static final int uploadSonicWaveFace = 8;
	public static final int uploadSonicWaveFace_SonicWaveFace = 800;
    public static final int uploadSonicWaveData = 9;
	public static final int commitInspectionForm = 10;
    public static final int uploadImage = 11;
	public static final int pileTestEnd = 12;
    public static final int downSect = 13;
	public static final int downSiteBySectId = 14;
    public static final int downQInspectionForm = 15;
	public static final int downSInspectionForm = 16;


	public static String getErrorInfo(int testType,int code)
    {
        return getInstance().getErrorMessage(testType,String.format("%d",code));
    }
    private static HttpMessage mInstance;

    public static HttpMessage getInstance()
    {
        synchronized (HttpMessage.class)
        {
            if (mInstance == null)
                mInstance = new HttpMessage();
        }
        return mInstance;
    }

    private String getErrorMessage(int testType,String code)
    {
        switch (testType)
        {
            case 0:
                if (dic0.get(code) != null)
                {
                    return dic0.get(code).toString();
                }
                break;
			case 1:
                if (dic1.get(code) != null)
                {
                    return dic1.get(code).toString();
                }
                break;
			case 2:
                if (dic2.get(code) != null)
                {
                    return dic2.get(code).toString();
                }
                break;
			case 3:
                if (dic3.get(code) != null)
                {
                    return dic3.get(code).toString();
                }
                break;
			case 4:
                if (dic4.get(code) != null)
                {
                    return dic4.get(code).toString();
                }
                break;
			case 5:
                if (dic5.get(code) != null)
                {
                    return dic5.get(code).toString();
                }
                break;
			case 6:
                if (dic6.get(code) != null)
                {
                    return dic6.get(code).toString();
                }
                break;
			case 7:
                if (dic7.get(code) != null)
                {
                    return dic7.get(code).toString();
                }
                break;
			case 8:
			    StringBuilder stringBuilder = new StringBuilder(code);
			    if (stringBuilder.length() > 3)
                    stringBuilder.deleteCharAt(1);
                if (dic8.get(stringBuilder.toString()) != null)
                {
                    return dic8.get(stringBuilder.toString()).toString();
                }
                break;
			case 9:
                if (dic9.get(code) != null)
                {
                    return dic9.get(code).toString();
                }
                break;
			case 10:
                if (dic10.get(code) != null)
                {
                    return dic10.get(code).toString();
                }
                break;
			case 11:
                if (dic11.get(code) != null)
                {
                    return dic11.get(code).toString();
                }
                break;
			case 12:
                if (dic12.get(code) != null)
                {
                    return dic12.get(code).toString();
                }
                break;
			case 13:
                if (dic13.get(code) != null)
                {
                    return dic13.get(code).toString();
                }
                break;
			case 14:
                if (dic14.get(code) != null)
                {
                    return dic14.get(code).toString();
                }
                break;
            case 15:
                if (dic15.get(code) != null)
                {
                    return dic15.get(code).toString();
                }
                break;
            case 16:
                if (dic16.get(code) != null)
                {
                    return dic16.get(code).toString();
                }
                break;
			case 300:
                if (dic3h.get(code) != null)
                {
                    return dic3h.get(code).toString();
                }
                break;
			case 3000:
                if (dic3c.get(code) != null)
                {
                    return dic3c.get(code).toString();
                }
                break;
			case 800:
                if (dic8s.get(code) != null)
                {
                    return dic8s.get(code).toString();
                }
                break;
            default:
                return "";
        }
        return "";
    }

    private static HashMap dic0 = new HashMap<String,String>();     //用户验证接口verifyAppUser
    private static HashMap dic1 = new HashMap<String,String>();   //低应变检测上传接口uploadLowStrain
	private static HashMap dic2 = new HashMap<String,String>();   //低应变检测数据上传接口upLowStrainData
    private static HashMap dic3 = new HashMap<String,String>();   //高应变检测数据上传接口uploadHighStrain
	private static HashMap dic3h = new HashMap<String,String>();   //高应变检测数据上传接口uploadHighStrain类HammerData成员
	private static HashMap dic3c = new HashMap<String,String>();   //高应变检测数据上传接口uploadHighStrain类ChannelData成员
	private static HashMap dic4 = new HashMap<String,String>();   //静载信息上传接口uploadStaticLoad
    private static HashMap dic5 = new HashMap<String,String>();   //静载检测数据上传接口uploadStaticLoadTest
	private static HashMap dic6 = new HashMap<String,String>();   //静载日志信息上传接口uploadStaticLoadLog
    private static HashMap dic7 = new HashMap<String,String>();   //声波检测基础数据上传接口uploadSonicWave
	private static HashMap dic8 = new HashMap<String,String>();   //声波检测剖面上传接口uploadSonicWaveFace
    private static HashMap dic8s = new HashMap<String,String>();   //声波检测剖面上传接口uploadSonicWaveFace类SonicWaveFace成员
	private static HashMap dic9 = new HashMap<String,String>();   //声波检测数据上传接口uploadSonicWaveData
	private static HashMap dic10 = new HashMap<String,String>();  //提交报检单状态接口commitInspectionForm
    private static HashMap dic11 = new HashMap<String,String>();  //上传图片接口uploadImage
	private static HashMap dic12 = new HashMap<String,String>();  //单桩检测完成接口（低应变、静载）pileTestEnd
    private static HashMap dic13 = new HashMap<String,String>();  //标段信息下载downSect
	private static HashMap dic14 = new HashMap<String,String>();  //工点信息下载downSiteBySectId
    private static HashMap dic15 = new HashMap<String,String>();  //报检单（桥）下载downInspectionForm
	private static HashMap dic16 = new HashMap<String,String>();  //报检单（路隧）下载downInspectionForm


    private HttpMessage()
    {
		//verifyAppUser用户验证接口
        dic0.put("-1","账号有误");
        dic0.put("-2","设备唯一标识有误");
        dic0.put("-3","密码有误");
        dic0.put("-4","密钥有误");
        dic0.put("-90","网络异常");
		dic0.put("-99","其他错误");
		//uploadLowStrain低应变检测上传接口
        dic1.put("-1","随机码有误");
        dic1.put("-2","账号有误");
        dic1.put("-3","报检单ID有误");
        dic1.put("-4","报检单编号有误");
        dic1.put("-5","设备商标识有误");
		dic1.put("-6","设备编号有误");
        dic1.put("-7","流水号有误");
        dic1.put("-8","试桩编号有误");
        dic1.put("-9","文件名有误");
        dic1.put("-10","测试开始时间有误");
		dic1.put("-11","桩号ID有误");
        dic1.put("-12","实际桩径有误");
        dic1.put("-13","实际桩长有误");
        dic1.put("-14","预设波速有误");
        dic1.put("-15","采样数量有误");
		dic1.put("-16","自定义参数有误");
        dic1.put("-17","有效数量总条数有误");
        dic1.put("-18","经纬度坐标X有误");
        dic1.put("-19","经纬度坐标Y有误");
		dic1.put("-90","网络异常");
		dic1.put("-99","其他错误");
		

		//upLowStrainData低应变检测数据上传接口
        dic2.put("-1","随机码有误");
        dic2.put("-2","账号有误");
        dic2.put("-3","低应变检测ID有误");
        dic2.put("-4","桩ID有误");
        dic2.put("-5","有效数据当前次序有误");
		dic2.put("-6","记录唯一性标识有误");
        dic2.put("-7","采样点的点号有误");
        dic2.put("-8","当前锤次有误");
        dic2.put("-9","采样时间有误");
        dic2.put("-10","本道信号的增益值有误");
		dic2.put("-11","高通滤波有误");
        dic2.put("-12","低通滤波有误");
        dic2.put("-13","是否积分有误");
        dic2.put("-14","探头类型有误");
        dic2.put("-15","采样间隔有误");
		dic2.put("-16","传感器系数有误");
        dic2.put("-17","桩顶位置有误");
		dic2.put("-18","桩底位置有误");
        dic2.put("-19","延迟点数有误");
		dic2.put("-20","采样点数有误");
        dic2.put("-21","波形数值有误");
		dic2.put("-90","网络异常有误");
		dic2.put("-98","其他错误有误");
		dic2.put("-99","其他错误有误");
		
		
		//uploadHighStrain高应变检测数据上传接口
		dic3.put("-1","随机码有误");
        dic3.put("-2","账号有误");
        dic3.put("-3","报检单ID有误");
        dic3.put("-4","报检单编号有误");
        dic3.put("-5","设备商标识有误");
		dic3.put("-6","设备编号有误");
        dic3.put("-7","流水号有误");
        dic3.put("-8","桩ID有误");
        dic3.put("-9","试桩编号有误");
        dic3.put("-10","文件名有误");
		dic3.put("-11","测试开始时间有误");
        dic3.put("-12","总锤数有误");
        dic3.put("-13","文件类型有误");
        dic3.put("-14","经纬度坐标X有误");
        dic3.put("-15","经纬度坐标Y有误");
		dic3.put("-16","锤数据集合有误");
        dic3.put("-90","网络异常");
        dic3.put("-99","未知错误");
		
		dic3h.put("-i0100","第i锤次的当前锤数有误");
		dic3h.put("-i0200","第i锤次的实际桩径有误");
		dic3h.put("-i0300","第i锤次的实际桩长有误");
		dic3h.put("-i0400","第i锤次的测点下桩长有误");
		dic3h.put("-i0500","第i锤次的通道数量有误");
		dic3h.put("-i0600","第i锤次的入土桩长有误");
		dic3h.put("-i0700","第i锤次的测点处截面积有误");
		dic3h.put("-i0800","第i锤次的桩底截面积有误");
		dic3h.put("-i0900","第i锤次的桩身截面积有误");
		dic3h.put("-i0100","第i锤次的桩身密度有误");
		dic3h.put("-i0110","第i锤次的测点处密度有误");
		dic3h.put("-i0120","第i锤次的平均波速有误");
		dic3h.put("-i0130","第i锤次的测点波速有误");
		dic3h.put("-i0140","第i锤次的凯斯系数有误");
		dic3h.put("-i0150","第i锤次的落距有误");
		dic3h.put("-i0160","第i锤次的锤重有误");
		dic3h.put("-i0170","第i锤次的采样点数有误");
		dic3h.put("-i0180","第i锤次的采样间隔有误");
		dic3h.put("-i0190","第i锤次的设计承载力有误");
		dic3h.put("-i0200","第i锤次的初始入土深度有误");
		dic3h.put("-i0210","第i锤次的预计每击灌入度有误");
		dic3h.put("-i0220","第i锤次的阻尼系数法的承载力有误");
		dic3h.put("-i0230","第i锤次的最大阻力有误");
		dic3h.put("-i0240","第i锤次的卸载法的承载力有误");
		dic3h.put("-i0250","第i锤次的力最大值有误");
		dic3h.put("-i0260","第i锤次的速度最大值有误");
		dic3h.put("-i0270","第i锤次的应变最大值有误");
		dic3h.put("-i0280","第i锤次的位移最大值有误");
		dic3h.put("-i0290","第i锤次的位移最终值有误");
		dic3h.put("-i0300","第i锤次的最大压应力有误");
		dic3h.put("-i0310","第i锤次的最大拉应力有误");
		dic3h.put("-i0320","第i锤次的桩顶游标位置有误");
		dic3h.put("-i0330","第i锤次的桩底游标位置有误");
		dic3h.put("-i0340","第i锤次的截面周长有误");
		dic3h.put("-i0350","第i锤次的砼强度有误");
		dic3h.put("-i0360","第i锤次的自定义信息有误");
		dic3h.put("-i0370","第i锤次的通道数据集合有误");
		dic3c.put("-i00j1","第i锤次的第j个高应变数据记录唯一性标识有误");
		dic3c.put("-i00j2","第i锤次的第j个高应变数据通道号有误");
		dic3c.put("-i00j3","第i锤次的第j个高应变数据探头类型有误");
		dic3c.put("-i00j4","第i锤次的第j个高应变数据延迟点数有误");
		dic3c.put("-i00j5","第i锤次的第j个高应变数据本道信号的增益值有误");
		dic3c.put("-i00j6","第i锤次的第j个高应变数据灵敏度系数有误");
		dic3c.put("-i00j7","第i锤次的第j个高应变数据波形数值有误");
		
		
		
		//uploadStaticLoad静载信息上传接口
		dic4.put("-1","随机码有误");
        dic4.put("-2","账号有误");
        dic4.put("-3","报检单ID有误");
        dic4.put("-4","报检单编号有误");
        dic4.put("-5","设备商标识有误");
		dic4.put("-6","测试类型有误");
        dic4.put("-7","测试规范有误");
        dic4.put("-8","设备编号有误");
        dic4.put("-9","流水号有误");
        dic4.put("-10","桩ID有误");
		dic4.put("-11","试桩编号有误");
		dic4.put("-12","文件名有误");
        dic4.put("-13","预分级数有误");
        dic4.put("-14","最大预估荷载有误");
        dic4.put("-15","压板面积有误");
        dic4.put("-16","测试开始时间有误");
		dic4.put("-17","加载读数间隔有误");
        dic4.put("-18","卸载读数间隔有误");
		dic4.put("-19","位移传感器编号有误");
        dic4.put("-20","位移传感器用途有误");
		dic4.put("-21","压力传感器类型有误");
        dic4.put("-22","压力传感器编号有误");
		dic4.put("-23","力传感器修正系数有误");
        dic4.put("-24","力传感器量程有误");
        dic4.put("-25","自定义参数有误");
        dic4.put("-26","有效检测数据总条数有误");
		dic4.put("-27","有效日志数据总条数有误");
        dic4.put("-28","经纬度坐标X有误");
		dic4.put("-29","经纬度坐标Y有误");
        dic4.put("-90","网络异常");
		dic4.put("-99","其他错误");
		
		
		//uploadStaticLoadTest静载检测数据上传接口
		dic5.put("-1","随机码有误");
        dic5.put("-2","账号有误");
        dic5.put("-3","静载基本信息id有误");
        dic5.put("-4","有效数据当前次序有误");
        dic5.put("-5","记录id有误");
		dic5.put("-6","采样时间有误");
        dic5.put("-7","当前进程有误");
        dic5.put("-8","当前级别有误");
        dic5.put("-9","当前级别采样次数有误");
        dic5.put("-10","当前级别累计时间有误");
		dic5.put("-11","当前级别理论荷载有误");
		dic5.put("-12","当前实际荷载有误");
        dic5.put("-13","当前实际油压有误");
        dic5.put("-14","各通道位移值的集合有误");
        dic5.put("-15","平均位移有误");
		dic5.put("-90","网络异常有误");
		dic5.put("-98","其他错误有误");
		dic5.put("-99","其他错误有误");
		
		
		//uploadStaticLoadLog静载日志信息上传借口
		dic6.put("-1","随机码");
        dic6.put("-2","账号");
        dic6.put("-3","静载基本信息id");
        dic6.put("-4","有效数据当前次序");
        dic6.put("-5","记录id");
        dic6.put("-6","事件发生的时间");
        dic6.put("-7","事件类型的描述");
        dic6.put("-8","事件的详细信息");
        dic6.put("-90","网络异常");
        dic6.put("-98","重复");
        dic6.put("-99","其他错误");
       
		
		
		//uploadSonicWave声波检测基础数据上传接口
		dic7.put("-1","随机码有误");
        dic7.put("-2","账号有误");
        dic7.put("-3","报检单ID有误");
        dic7.put("-4","报检单编号有误");
        dic7.put("-5","设备商标识有误");
		dic7.put("-6","设备编号有误");
        dic7.put("-7","流水号有误");
        dic7.put("-8","桩ID有误");
        dic7.put("-9","试桩编号有误");
        dic7.put("-10","测试规范有误");
		dic7.put("-11","开始检测时间有误");
		dic7.put("-12","文件名有误");
        dic7.put("-13","实际桩径有误");
        dic7.put("-14","实际桩长有误");
        dic7.put("-15","移距有误");
        dic7.put("-16","管数有误");
		dic7.put("-17","采样间隔有误");
        dic7.put("-18","采样点数有误");
		dic7.put("-19","AD转换器的位数有误");
        dic7.put("-20","方位角有误");
		dic7.put("-21","高通有误");
        dic7.put("-22","低通有误");
		dic7.put("-23","幅值系数有误");
        dic7.put("-24","自定义参数有误");
        dic7.put("-25","剖面总数有误");
        dic7.put("-26","经纬度坐标X有误");
		dic7.put("-27","经纬度坐标Y有误");
        dic7.put("-28","传感器直径有误");
		dic7.put("-29","发射电压有误");
		dic7.put("-91","已取消");
		dic7.put("-90","网络异常");
		dic7.put("-99","其他错误");
		
		
		//uploadSonicWaveFace声波检测剖面上传接口
		dic8.put("-1","随机码有误");
        dic8.put("-2","账号有误");
        dic8.put("-3","声波检测基础数据id有误");
        dic8.put("-4","剖面信息集合有误");
		
        dic8.put("-01","剖面id有误");
		dic8.put("-02","剖面实验方法有误");
        dic8.put("-03","剖面剖面名称有误");
        dic8.put("-04","剖面跨距有误");
        dic8.put("-05","剖面传感器高差有误");
        dic8.put("-06","剖面校零有误");
		dic8.put("-07","剖面起点高程有误");
		dic8.put("-08","剖面测点数量有误");
        dic8.put("-09","剖面平均波速有误");
        dic8.put("-10","剖面平均波幅有误");
        dic8.put("-11","剖面频率平均值有误");
        dic8.put("-12","剖面波速最小值有误");
		dic8.put("-13","剖面波幅最小值有误");
        dic8.put("-14","剖面声速异常判定值(临界值)有误");
		dic8.put("-15","剖面波幅临界值有误");
        dic8.put("-16","剖面频率临界值有误");
		dic8.put("-17","剖面声速标准差有误");
        dic8.put("-18","剖面波幅标准差有误");
		dic8.put("-19","剖面频率标准差有误");
        dic8.put("-20","剖面声速离散系数有误");
		dic8.put("-21","剖面波幅离散系数有误");
        dic8.put("-22","剖面频率离散系数有误");
		dic8.put("-23","剖面均匀性等级有误");
        dic8.put("-24","剖面测试深度有误");
		dic8.put("-90","网络异常");
        dic8.put("-91","已取消");
		dic8.put("-98","重复");
        dic8.put("-99","其他错误");
		
		
		//uploadSonicWaveData声波检测数据上传接口
		dic9.put("-1","随机码有误");
        dic9.put("-2","账号有误");
        dic9.put("-3","声波检测基础数据id有误");
        dic9.put("-4","有效数据当前次序有误");
        dic9.put("-5","剖面id有误");
		dic9.put("-6","记录id有误");
        dic9.put("-7","深度有误");
        dic9.put("-8","采样时间有误");
        dic9.put("-9","增益有误");
        dic9.put("-10","延时有误");
		dic9.put("-11","首波峰索引值有误");
		dic9.put("-12","首波声时索引有误");
        dic9.put("-13","声时有误");
        dic9.put("-14","声速有误");
        dic9.put("-15","波幅有误");
        dic9.put("-16","主频有误");
		dic9.put("-17","PSD有误");
        dic9.put("-18","波形数值有误");
		dic9.put("-90","网络异常");
		dic9.put("-98","重复");
        dic9.put("-99","其他错误");
		
		
		//commitInspectionForm提交报检单状态接口
		dic10.put("-1","随机码有误");
        dic10.put("-2","账号有误");
        dic10.put("-3","报检单ID有误");
        dic10.put("-4","报检单编号有误");
        dic10.put("-5","已检测桩数有误");
		dic10.put("-6","备注有误");
        dic10.put("-7","驳回状态有误");
        dic10.put("-8","桩ID有误");
        dic10.put("-9","检测说明有误");
		dic10.put("-90","网络异常");
		dic10.put("-98","重复");
        dic10.put("-99","其他错误");
		
		
		//uploadImage上传图片接口
		dic11.put("-1","随机码有误");
        dic11.put("-2","账号有误");
        dic11.put("-3","图片对象有误");
        dic11.put("-4","报检单ID有误");
        dic11.put("-5","报检单编号有误");
		dic11.put("-6","桩号有误");
        dic11.put("-7","实验类型有误");
        dic11.put("-8","事件发生的时间有误");
        dic11.put("-9","事件类型的描述有误");
        dic11.put("-10","图片类型有误");
		dic11.put("-11","剖面id有误");
		
		dic11.put("-90","网络异常");
        dic11.put("-91","图片大小超过1M");
		dic11.put("-92","图片格式有误");
		dic11.put("-98","重复");
        dic11.put("-99","其他错误");
		
		
		//pileTestEnd单桩检测完成接口（低应变、静载）
		dic12.put("-1","随机码有误");
        dic12.put("-2","账号有误");
        dic12.put("-3","检测基础数据ID有误");
        dic12.put("-4","检测方法有误");
        dic12.put("-5","有效数据总条数有误");
		dic12.put("-6","有效日志数据总条数有误");
		
		dic12.put("-90","网络异常");
		dic12.put("-98","重复");
        dic12.put("-99","其他错误");
		
		//downSect标段信息下载
		dic13.put("-1","随机码有误");
		
		dic13.put("-99","其他错误");
		
		
		//downSiteBySectId工点信息下载
		dic14.put("-1","随机码有误");
        dic14.put("-2","标段ID有误");
        dic14.put("-99","其他错误");
		
		
		//downInspectionForm报检单（桥）下载
		dic15.put("-1","随机码有误");
        dic15.put("-2","标段ID有误");
        dic15.put("-3","工点ID有误");
        dic15.put("-4","开始时间有误");
        dic15.put("-5","结束时间有误");
		
		dic15.put("-99","其他错误");
		
		
	    //downInspectionForm报检单（路隧）下载
		dic16.put("-1","随机码有误");
        dic16.put("-2","标段ID有误");
        dic16.put("-3","工点ID有误");
        dic16.put("-4","开始时间有误");
        dic16.put("-5","结束时间有误");
		dic16.put("-99","其他错误");
    }




}
